home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: What is wrong in this code?
- Date: 13 Jan 1996 00:08:18 -0500
- Organization: University of Maryland Baltimore County
- Message-ID: <4d7eo2$hcl@umbc9.umbc.edu>
- References: <DL2z7o.2K5@scisun.sci.ccny.cuny.edu>
- NNTP-Posting-Host: f-umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- Sergio Rojas <sergio@sci.ccny.cuny.edu> wrote:
- |> I am traying to be literate in C and here is a
- |> problem wich I have been unable to detect:
- |>
- |> #include <stdio.h>
- |> #include <math.h>
- |>
- |> main()
- |> {
- |> double x;
- |>
- |> printf("\n Enter a number \n");
- |>
- |> scanf("%f", &x);
-
- <rest deleted>
-
- This is in the FAQ...
-
- 12.13: Why doesn't this code:
-
- double d;
- scanf("%f", &d);
-
- work?
-
- A: Unlike printf(), scanf() uses %lf for values of type double, and
- %f for float. See also question 12.9.
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-